package merisis.experiments.gcs;


public class GCSearch5Util {

	public static void main(String[] argv) {

		int[] codes = new int[] {

		1102, 1113, 1201, 1213, 1301, 1313, 1402, 1413, 1504, 1513, 1604, 1613,

		2102, 2113, 2201, 2213, 2301, 2313, 2402, 2413, 2504, 2513, 2604, 2613,

		3101, 3113, 3202, 3213, 3302, 3313, 3401, 3413, 3504, 3513, 3604, 3613,

		4101, 4113, 4202, 4213, 4302, 4313, 4401, 4413, 4504, 4513, 4604, 4613,

		5102, 5112, 5201, 5211, 5301, 5311, 5402, 5412, 5504, 5514, 5604, 5614,

		6102, 6112, 6201, 6211, 6301, 6311, 6402, 6412, 6504, 6514, 6604, 6614

		};

		int[] t = new int[codes.length];
		for (int i = codes.length - 1; i >= 0; i--) {
			int code = codes[i];

			int d3, d2, d1, d0;

			d3 = code / 1000;
			code %= 1000;
			d2 = code / 100;
			code %= 100;
			d1 = code / 10;
			d0 = code % 10;

			t[i] = (d2 << 7) | (d3 << 4) | (d1 << 3) | d0;
		}

		// Arrays.sort(t);

		byte[] tbl = new byte[128];
		for (int i = t.length - 1; i >= 0; i--) {
			int code = t[i];
			tbl[code >>> 3] = (byte) (code & 0x7);
		}

		StringBuilder sb = new StringBuilder();
		sb.append('{');
		sb.append(tbl[0]);
		for (int i = 1; i < tbl.length; i++) {
			sb.append(',');
			sb.append(tbl[i]);
		}
		sb.append("};");

		System.out.println(sb.toString());

	}
}
